package org.example.template.common;



import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TestHandlerInterceptor implements HandlerInterceptor {


    //只需要关注前置拦截器就可以了
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        request.getSession().setAttribute("publicKey","123465");
        System.out.println("我是拦截器"+handler);
        return true;//返回true为放行
    }
}
